Page({
   data: {
      sysHeight: 0,
      sysWidth: 0,
      listHeight: 500,
      current: 'tab1',
      tabs: [{
            key: 'tab1',
            title: '招生计划',
            content: [{
                  choolName: "内蒙古农业大学1",
                  schoolPhoto: "http://pbqg2m54r.bkt.clouddn.com/logo.png",
                  schoolTips: '综合排名：1',
                  seeTime: "2018-01-11"
               },
               {
                  choolName: "内蒙古农业大学1",
                  schoolPhoto: "http://pbqg2m54r.bkt.clouddn.com/logo.png",
                  schoolTips: '综合排名：2',
                  seeTime: "2018-01-11"
               },
               {
                  choolName: "内蒙古农业大学1",
                  schoolPhoto: "http://pbqg2m54r.bkt.clouddn.com/logo.png",
                  schoolTips: '综合排名：3',
                  seeTime: "2018-01-11"
               },
               {
                  choolName: "内蒙古农业大学1",
                  schoolPhoto: "http://pbqg2m54r.bkt.clouddn.com/logo.png",
                  schoolTips: '综合排名：4',
                  seeTime: "2018-01-11"
               },
               {
                  choolName: "内蒙古农业大学1",
                  schoolPhoto: "http://pbqg2m54r.bkt.clouddn.com/logo.png",
                  schoolTips: '综合排名：5',
                  seeTime: "2018-01-11"
               },
               {
                  choolName: "内蒙古农业大学1",
                  schoolPhoto: "http://pbqg2m54r.bkt.clouddn.com/logo.png",
                  schoolTips: '综合排名：6',
                  seeTime: "2018-01-11"
               }
            ]
         },
         {
            key: 'tab2',
            title: '历年招生',
            content: [],
         }
      ],
   },
   onLoad() {
      this.getSystemInfo();
   },
   onTabsChange(e) {
      console.log('onTabsChange', e)
      const {
         key
      } = e.detail
      const index = this.data.tabs.map((n) => n.key).indexOf(key)

      this.setData({
         key,
         index,
      })
   },
   onSwiperChange(e) {
      console.log('onSwiperChange', e)
      const {
         current: index,
         source
      } = e.detail
      const {
         key
      } = this.data.tabs[index]

      if (!!source) {
         this.setData({
            key,
            index,
         })
      }
   },
   getSystemInfo() {
      var that = this;
      wx.getSystemInfo({
         success: function(res) {
            that.setData({
               sysWidth: res.windowWidth,
               sysHeight: res.windowHeight,
               listHeight: res.windowHeight - 48
            })
         },
      })
   },
})